const express = require('express');
const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});
app.get('/login', async(req, res) => {
  const axios = require('axios')
  const resp = await axios.get('https://pvp.qq.com/web201605/js/herolist.json')
  console.log(resp)
  res.header('access-control-allow-origin','*')
  res.send('Login request received');
  
});

app.get('/jsonp',(req,res)=>{
  const cname = 'callback';
  const data = {
    msg:"from serve"
  }

  res.set('content-type','application/json')
  res.send(`${cname}(${JSON.stringify(data)})`)
})

app.listen(3000, () => {
    console.log('Express server running on port 3000');
});

